<template>
  <div class="app-container">
    <!-- 查询结果 -->
    <el-table :data="measureList" element-loading-text="正在查询中。。。" border fit highlight-current-row>
      <el-table-column align="center" width="100px" label="记录号" prop="id" sortable/>
      <el-table-column align="center" label="测量时间" prop="measureTime"/>
      <el-table-column align="center" label="置留长度" prop="lienLength"/>
      <el-table-column align="center" label="外露长度" prop="exposure"/>
      <el-table-column align="center" label="左侧臂围" prop="leftArmline"/>
      <el-table-column align="center" label="右侧臂围" prop="rightArmline"/>
      <el-table-column align="center" label="穿刺点情况" prop="lienState"/>
      <el-table-column align="center" label="上报时间" prop="addTime"/>
    </el-table>
  </div>
</template>
<script>
import { getListByPatientId, getAllMeasure } from '@/api/measure'

export default {
  name: 'Records',
  props: {
    patient: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      measureList: [],
      nurseId: 0
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      if (this.patient !== 0) {
        getListByPatientId({
          patientId: this.patient
        }).then(response => {
          this.measureList = response.data.data
          console.log(this.measureList)
        })
      } else {
        if (typeof (this.$store.getters.nurse) !== 'undefined') { this.nurseId = this.$store.getters.nurse.id }
        console.log(this.nurseId)
        getAllMeasure({
          nurseId: this.nurseId
        }).then(response => {
          this.measureList = response.data.data
          console.log(this.measureList)
        })
      }
    }
  }
}
</script>

<style scoped>

</style>
